import {View,Text,StyleSheet,TouchableHighlight,Button} from 'react-native';
import BookList from '../../components/BookList';
import {TBookItem} from '../../types/book';
import {SafeAreaView} from 'react-native-safe-area-context';
import NavBar from '../../components/NavBar';
import {useEffect, useState} from 'react';
import {fetchBookList} from '../../api';

export interface JsBookProps {
  navigation: any;
}

const JsBook = ({navigation}: JsBookProps) => {
  const [list, setList] = useState<TBookItem[]>([]);
 
  useEffect(() => {
    fetchBookList().then(res => {
      setList(res.data);
    });
  }, []);


  return (
    <View style={styles.container}>
      <Button title="algorithmBook"
    onPress={() => navigation.navigate('algorithmBook')}/>
    <Button title="NotificationDetail"
    onPress={() => navigation.navigate('notificationDetail')}/>
      <Button title="getRegisterID"
    onPress={() => JPush.getRegistrationID(result =>
      console.log("registerID:" + JSON.stringify(result))
      )}/>
    </View>
  );
};
// 样式
const styles = StyleSheet.create({
  container: {
    width:'100%',
    height:200,
    textAlign:'center',
  },
  t_text:{
    width:'100%',
    height:50,
  },
  
});
export default JsBook;
